package com.sinry.middleware.messages.producer;

import com.sinry.message.enums.RabbitQueue;
import org.springframework.amqp.rabbit.core.RabbitTemplate;

/**
 * @author linxinlei
 * @project sinry-cloud
 * @description 消息生产者
 * @date 2022/5/28
 **/
public interface MessageProducer extends RabbitTemplate.ReturnsCallback, RabbitTemplate.ConfirmCallback {

    /**
     * 存在队列
     *
     * @param rabbitQueue rabbit队列
     * @return bool
     */
    boolean inQueue(RabbitQueue rabbitQueue);

    /**
     * 发送消息
     *
     * @param data 消息内容
     */
    default void send(Object data) {
        throw new IllegalArgumentException("not a valid producer!!");
    }
}
